function parseContent(content){
	return content.replace(/[@]+[A-Za-z0-9-_]+/g, function(u) {
		var link = "<a href='/"+u.replace("@","")+"' class='userLink' target='_blank'>"+u+"</a>";
		return link;
	}).replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function(u) {
		return "<a href='"+u+"' class='urlLink' target='_blank'>"+u+"</a>";
	});
}
function shareParse(content){
	return content.replace(/[\r|\n]/g, ' ').replace(/'/g, "%47").replace(/"/g,"%42");
}
function timeleft(time){
	var startDate = new Date(time.substring(0,4),time.substring(5,7),time.substring(8,10),time.substring(11,13),time.substring(14,16),00);
	var dt = new Date();
	var endDate  = new Date(dt.getFullYear(),dt.getMonth()+1 ,dt.getDate() ,dt.getHours() ,dt.getMinutes() ,00);
	var time_left = (endDate.getTime() - startDate.getTime()) / 60000;
	var time = 1000*60*60*24;
	if(time_left == 0){
		time_left = "방금전";
	}else if(time_left < 60){
		time_left += "분전";
	}else if(time_left < 1440){
		time_left = parseInt(time_left/60)+"시간전";
	}else if(time_left > 1440){
		var e_day = parseInt((endDate.getTime() - startDate.getTime()) / time);
		time_left = e_day+"일전";
			if(e_day > 29){
				var e_month = parseInt((endDate.getTime() - startDate.getTime()) / (time*30));
				time_left = e_month+"달전";
			}
			if(e_month > 11){
				time_left = parseInt((endDate.getTime() - startDate.getTime()) / (time*30*12))+"년전";
			}
	}
	return time_left;
}

var f_modal = {
	"show":function(id){
		$("#"+id).show(0).addClass("active").children().addClass("open");
	}
	,"hide":function(el){
		$(el).removeClass("active").children().removeClass("open");
		setTimeout(function(){$(el).hide(0);},300);
	}
}

function alertShow(type, message, dealy){
	var $el = $("<div class='alert alert-"+type+"'><button type='button' onclick='alertHide(this)' class='close'>×</button>"+message+"</div>");
	$("body").append($el);
	if(dealy != null){
		setTimeout(function(){$el.addClass("in");},100);
		setTimeout(function(){$el.removeClass("in");setTimeout(function(){$el.remove();},300);}, dealy);
	}
}